<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/commonTag.jsp" %>
<%@include file="/common/commonJS.jsp" %>
<!DOCTYPE html>
<html>
<head>

</head>
<body>
	<jsp:include page="../alert.jsp"/>
	<form class="form-horizontal" id="inputForm" method="post" name="inputForm">
		<c:if test="${edit}">
			<input type="hidden" name="user.id" id="username" value="${user.id}">
		</c:if>
		<fieldset class="well">
			<div class="clearfix"></div>
			<div class="control-group">
			    <label class="control-label" for="username">UserName:</label>
			    <div class="controls">
			        <input type="text" name="user.username" id="username" value="${user.username}" placeholder="UserName">
			    </div>
			 </div>
			<div class="clearfix"></div>
			<div class="control-group">
			    <label class="control-label" for="password">Password:</label>
			    <div class="controls">
			        <input type="password" name="user.password" id="password" placeholder="Password">
			    </div>
			 </div>
			 <div class="clearfix"></div>
			 <div class="control-group">
			    <label class="control-label" for="confirmPassword">Confirm Password:</label>
			    <div class="controls">
			        <input type="password" name="user.confirmPassword" id="confirmPassword">
			    </div>
			 </div>
			 <div class="clearfix"></div>
			 <div class="control-group">
			     <label class="control-label">User Status:</label>
			     <div class="controls">
				     <select class="selectpicker" name="user.status" id="status">
					     <option value="1" <c:if test="${user.status eq 1}">selected="selected"</c:if>>Normal</option>
						 <option value="2" <c:if test="${user.status eq 2}">selected="selected"</c:if>>Not Activated</option>
						 <option value="3" <c:if test="${user.status eq 3}">selected="selected"</c:if>>Locked</option>
						 <option value="4" <c:if test="${user.status eq 4}">selected="selected"</c:if>>Cancelled</option>
					 </select>	
				 </div>
			 </div>
			  <div class="controls">
			  	  <button type="submit" class="btn btn-primary">Submit</button>
			  	  <button type="button" class="btn" onclick="history.back();">Back</button>
			  </div>
		</fieldset>
	</form>
</body>
<script type="text/javascript">
	$(function(){
		if("${edit}" === "true"){
			$("#inputForm").attr("action",$.path+"/userAction!update.action");	
		} else {
			$("#inputForm").attr("action",$.path+"/userAction!add.action");
		}
	});
</script>
</html>